<%@ page import="java.net.URLEncoder" %>
<%@include file="taglibs.jspf" %>
<%--
可以用来下载也可以用于预览
如果超出65536行依然可以显示， 但是另存时将只能保留65536行
量太大迭代时候会出错
--%>
<%--<%@ page contentType="text/msexcel;charset=UTF-8" language="java" %>--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    response.setContentType("application/msexcel; charset=UTF-8");
    String fileName = "export_file_name.xls";//下载对话框的保存文件名
    fileName = "我了个去.xls";
    fileName = URLEncoder.encode("我了个去.xls", "UTF-8");
//    fileName = new String(fileName.getBytes("utf-8"), "iso-8859-1");
//    response.setHeader("Content-disposition", "attachment; filename="+ fileName);
    response.setHeader("Content-Disposition", "attachment; attachment; filename=" + fileName + "; filename*=utf-8''" + fileName + ".xls");
%>
<html xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">
<head>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
    <title>个人信息导出清单</title>
</head>
<table>
    <tr>
        <%--<td>姓名</td><td>年龄</td><td>性别</td><td>身份证号</td><td>......</td>--%>
        <th>姓名</th>
        <th>年龄</th>
        <th>性别</th>
        <th>身份证号</th>
        <th>......</th>
    </tr>
    <c:forEach begin="0" end="100000">
        <tr>
            <td>张三</td>
            <td>25</td>
            <td>男</td>
            <td x:str="'1234567890"/>
            <td>......</td>
        </tr>
    </c:forEach>
    <tr>
        <td>小妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹妹</td>
        <td>23</td>
        <td>女</td>
        <td x:str="'0987654321"></td>
        <td>......</td>
    </tr>
    <% /*利用Jsp输出更多行*/ %>
</table>
</html>